#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	int l,r,n;
	cin>>n>>l>>r;
	int a=r/n,b=l/n;
	if(r-l>=n)cout<<n-1;
	else
	{
		if(b-a>=1)cout<<n-1;
		else cout<<r%n;
	}
	return 0;
}
